/*
 * SDL_Manager.cpp
 */

#include "SDL_Manager.h"
#include "SDL.h"
#include "SDL_ttf.h"
#include "SDL_Exception.h"

bool SDL_Manager::wasIniciated = false;

SDL_Manager::SDL_Manager() {}

SDL_Manager::~SDL_Manager()
{
	SDL_EnableUNICODE( SDL_DISABLE );
	TTF_Quit();
	SDL_Quit();
}

void SDL_Manager::kit()
{
	if (!wasIniciated)
	{
		wasIniciated = true;
		if(SDL_Init(SDL_INIT_EVERYTHING) < 0)
		{
			throw SDL_Exception("Error de inicializacion de SDL");
		}
		if (TTF_Init() < 0)
		{
			throw SDL_Exception("Error de inicializacion de TTF");
	    }
		// Permite la captura de caracteres UNICODE (numPad) durante la ejecucion
		SDL_EnableUNICODE(SDL_ENABLE);
	}
}
